/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Tuan Nguyen
 */
@Entity
@Table(name = "Member")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Member1.findAll", query = "SELECT m FROM Member1 m"),
    @NamedQuery(name = "Member1.findByUserID", query = "SELECT m FROM Member1 m WHERE m.userID = :userID"),
    @NamedQuery(name = "Member1.findByFullName", query = "SELECT m FROM Member1 m WHERE m.fullName = :fullName"),
    @NamedQuery(name = "Member1.findByEmail", query = "SELECT m FROM Member1 m WHERE m.email = :email"),
    @NamedQuery(name = "Member1.findByPassword", query = "SELECT m FROM Member1 m WHERE m.password = :password"),
    @NamedQuery(name = "Member1.findByBirthday", query = "SELECT m FROM Member1 m WHERE m.birthday = :birthday"),
    @NamedQuery(name = "Member1.findBySex", query = "SELECT m FROM Member1 m WHERE m.sex = :sex"),
    @NamedQuery(name = "Member1.findByMobileNo", query = "SELECT m FROM Member1 m WHERE m.mobileNo = :mobileNo"),
    @NamedQuery(name = "Member1.findByAddress", query = "SELECT m FROM Member1 m WHERE m.address = :address"),
    @NamedQuery(name = "Member1.findByIsActive", query = "SELECT m FROM Member1 m WHERE m.isActive = :isActive"),
    @NamedQuery(name = "Member1.findByDateCreated", query = "SELECT m FROM Member1 m WHERE m.dateCreated = :dateCreated")})
public class Member1 implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "UserID")
    private Integer userID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "FullName")
    private String fullName;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "Email")
    private String email;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "Password")
    private String password;
    @Size(max = 10)
    @Column(name = "Birthday")
    private String birthday;
    @Column(name = "Sex")
    private Boolean sex;
    @Size(max = 50)
    @Column(name = "MobileNo")
    private String mobileNo;
    @Size(max = 150)
    @Column(name = "Address")
    private String address;
    @Column(name = "IsActive")
    private Boolean isActive;
    @Size(max = 10)
    @Column(name = "DateCreated")
    private String dateCreated;
    @JoinColumn(name = "RoleID", referencedColumnName = "RoleID")
    @ManyToOne
    private Roles roleID;
    @OneToMany(mappedBy = "createUserID")
    private Collection<RealEstate> realEstateCollection;
    @OneToMany(mappedBy = "createUserID")
    private Collection<Companys> companysCollection;

    public Member1() {
    }

    public Member1(Integer userID) {
        this.userID = userID;
    }

    public Member1(Integer userID, String fullName, String email, String password) {
        this.userID = userID;
        this.fullName = fullName;
        this.email = email;
        this.password = password;
    }

    public Integer getUserID() {
        return userID;
    }

    public void setUserID(Integer userID) {
        this.userID = userID;
    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public Boolean getSex() {
        return sex;
    }

    public void setSex(Boolean sex) {
        this.sex = sex;
    }

    public String getMobileNo() {
        return mobileNo;
    }

    public void setMobileNo(String mobileNo) {
        this.mobileNo = mobileNo;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Boolean getIsActive() {
        return isActive;
    }

    public void setIsActive(Boolean isActive) {
        this.isActive = isActive;
    }

    public String getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(String dateCreated) {
        this.dateCreated = dateCreated;
    }

    public Roles getRoleID() {
        return roleID;
    }

    public void setRoleID(Roles roleID) {
        this.roleID = roleID;
    }

    @XmlTransient
    public Collection<RealEstate> getRealEstateCollection() {
        return realEstateCollection;
    }

    public void setRealEstateCollection(Collection<RealEstate> realEstateCollection) {
        this.realEstateCollection = realEstateCollection;
    }

    @XmlTransient
    public Collection<Companys> getCompanysCollection() {
        return companysCollection;
    }

    public void setCompanysCollection(Collection<Companys> companysCollection) {
        this.companysCollection = companysCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (userID != null ? userID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Member1)) {
            return false;
        }
        Member1 other = (Member1) object;
        if ((this.userID == null && other.userID != null) || (this.userID != null && !this.userID.equals(other.userID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "userID=" + userID + " ";
    }
    
}
